<!DOCTYPE html>
<html lang="en"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:t="http://myfaces.apache.org/tomahawk"
>

    <h:body>
    	<ui:composition template="../Template/template.xhtml">
    		<ui:define name="content">
    			<section id="content">
	    			<h2>Ajouter un élément à votre agenda</h2>
	    			<p> Ajouter un nouvel élément de travail à votre agenda. </p>
	    			<h:form id="newprojectform">
						<fieldset>
							<section>
								<label for="task">Tâche</label>
								<div>
									<h:selectOneMenu id="task" value="#{WorkPieceBean.workPieceTskId}" required="true" requiredMessage="Spécifiez une tâche">
										<f:selectItems value="#{input.myTasksItems}"/>
									</h:selectOneMenu>
                                    <h:message for="task" class='error-message'></h:message>
								</div>
							</section>
							<section>
                                <label for="status">Statut de la tâche</label>
                                <div>
                                    <h:selectOneMenu id="status" value="#{WorkPieceBean.taskTssId}" required="true" requiredMessage="Spécifiez un statut">
                                        <f:selectItems value="#{input.tssItems}"/>
                                    </h:selectOneMenu>
                                    <h:message for="status" class='error-message'></h:message>
                                </div>
                            </section>
							<section>
								<label for="comment"> Commentaires </label>
								<div>
									<h:inputTextarea id="comment" value="#{WorkPieceBean.workPieceComment}" />
								</div>
							</section>
							<section>
								<label for="date"> Date </label>
								<div>
									<t:panelGroup styleClass="date_input">
										<t:inputCalendar id="date" 
										    type="date"
										    maxlength="10" 
										    value="#{WorkPieceBean.workPieceDate}"
										    monthYearRowClass="monthYearRowClass" 
										    weekRowClass="weekRowClass" 
										    dayCellClass="dayCellClass" 
										    currentDayCellClass="currentDayCellClass"
										    renderAsPopup="false"
										    alt="Calendar" title="Calendar" required="true" requiredMessage="Spécifiez une date">
                                    	</t:inputCalendar>
                                        <h:message for="date" class='error-message'></h:message>
									</t:panelGroup>
								</div>
							</section>
							<section>
								<label for="duration"> Durée </label>
								<div>
									<div>
                                        <h:inputText id="duration" value="#{WorkPieceBean.workPieceDuration}" required="true" requiredMessage="Spécifiez une durée"/>
                                        <h:message for="duration" class='error-message'></h:message>
                                    </div>
								</div>
							</section>
							<section>
								<div>
									<h:commandButton value="Créer cet élément" action="#{WorkPieceBean.createWorkPiece}"/>
								</div>
							</section>
						</fieldset>
					</h:form>
				</section>
    		</ui:define>
    	</ui:composition>    	
    </h:body>
 
</html>